package com.marvels.approve.manager.dto;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum LoanStateEnum {

	APPLYING("K00,K01","申请中","1",""),
	AUDITING("Z00,Z01,K02","审核中","1",""),
	REJECTION("ZR0,SR0,CR0,SR4","审核拒绝","1",""),
	WAIT_CONTRACT("P04","待签约","1",""),
	WAIT_LOAN("F01,P05,F03","待放款","1",""),
	CANCEL_LOAN("F81","取消放款","1",""),
	WAIT_REPAYMENT("D01","待还款","1",""),
	OVERDUE("yuqi","逾期","1",""),
	SETTLE("A00,A01","结清","1","");
	
	private String states;
	private String stateName;
	private String type;
	private String remark;
	
	LoanStateEnum(String states, String stateName, String type, String remark){
		this.states = states;
		this.stateName = stateName;
		this.type = type;
		this.remark = remark;
	}

	public String getStates() {
		return states;
	}

	public void setStates(String states) {
		this.states = states;
	}

	public String getStateName() {
		return stateName;
	}

	public void setStateName(String stateName) {
		this.stateName = stateName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	public static List<Map<String, String>> getStateList(String type){
		List<Map<String, String>> list = new ArrayList<Map<String, String>>();
		for (LoanStateEnum e : LoanStateEnum.values()) {
			if(e.getType().equals(type)){
				Map<String, String> map = new HashMap<String, String>();
				map.put("states", e.getStates());
				map.put("stateName", e.getStateName());
				list.add(map);
			}
		}
		return list;
	}
	
	public static String getNameByState(String state){
		String name = null;
		if(state != null){
			for (LoanStateEnum e : LoanStateEnum.values()) {
				if(e.getStates().contains(state)){
					name = e.stateName;
					break;
				}
			}
		}
		return name;
	}
}
